package server;

import java.util.ArrayList;
import java.util.List;

import common.Sendable;

import server.processors.*;

public class SendableTranslator {
	
	public static final List<Processor> processors = new ArrayList<Processor>();
	
	static {
		processors.add( new RegistrationProcessor() );
		processors.add( new RoundRequestProcessor() );
		processors.add( new AuctionProcessor() );
		processors.add( new AuctionCancellationProcessor() );
		processors.add( new ChatProcessor() );
		processors.add( new ReadyProcessor() );
	}

	public Runnable translate( NetworkMediator mediator, ServerStateMediator server,  Sendable s ) {
		
		for( Processor p : processors )
			if( p.isInterestedIn( s ) )
				return p.getInstanceOf(mediator, server);
		
		return null;
	}
}
